<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>购物车布局</title>
  <link href="css/cart.css" rel="stylesheet">
</head>
<body>
  <div id="app" class="container">
    <!-- 空购物车界面 -->
    <div class="empty-cart-message" v-if="cartItems.length === 0">
      <div class="empty-cart-image"></div>
      您的购物车空空如也
      <a href="#" class="go-checkout">去购物</a>
    </div>
    <div class="cart" v-else>
      <h1>科泰淘购物车</h1>
      <div class="clearfix">
        <a href="#" @click="deleteSelectedItems">删除选中</a>
        <a href="#" @click="clearCart">清空购物车</a>
      </div>
      <div class="cart-item" v-for="(item, index) in cartItems" :key="index">
        <div class="cart-item-details">
          <input type="checkbox" v-model="item.selected">
          <img :src="item.image" alt="商品图片">
          <div class="cart-item-name-sku">
            <div class="cart-item-name">{{ item.name }}</div>
            <div class="cart-item-sku">{{ item.sku }}</div>
          </div>
        </div>
        <div class="cart-item-quantity-price">
          <div class="cart-item-quantity">
            <button class="quantity-btn minus-btn" @click="decreaseQuantity(index)">-</button>
            <input type="text" name="quantity" class="quantity" v-model="item.quantity">
            <button class="quantity-btn plus-btn" @click="increaseQuantity(index)">+</button>
          </div>
          <div class="cart-item-price">￥{{ item.price }}</div>
        </div>
      </div>
      <div class="total-price-container">
        <div class="total-count">已选 <span>{{ selectedCount }}</span> 件</div>
        <div class="total-price">总计：￥{{ totalPrice }}</div>
      </div>
      <div class="clearfix">
        <div class="select-all-container">
          <input type="checkbox" v-model="isAllSelected">
          <label for="select-all-checkbox">全选</label>
        </div>
        <a href="#" class="go-checkout">去结算</a>
      </div>
    </div>
  </div>
  <script src="js/vue.js"></script>
  <script src="js/cart-vue.js"></script>
</body>
</html>